import request from '@/utils/request.ts'
import { categoryResponseData } from './type.ts'
// 一级
export const getCategory1 = () =>
  request.get<any, categoryResponseData>('/admin/product/getCategory1')
//二级
export const getCategory2 = (category1Id: number | string) =>
  request.get<any, categoryResponseData>(
    `/admin/product/getCategory2/${category1Id}`,
  )
//三级
export const getCategory3 = (category2Id: number | string) =>
  request.get<any, categoryResponseData>(
    `/admin/product/getCategory3/${category2Id}`,
  )
//获取属性
export const getCategory = (
  category1Id: number | string,
  category2Id: number | string,
  category3Id: number | string,
) =>
  request.get<any, any>(
    `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
  )
//保存属性
export const saveAttrInfo = (data: any) =>
  request.post('/admin/product/saveAttrInfo', data)
//删除属性
export const deleteAttr = (attrId: number) =>
  request.delete(`/admin/product/deleteAttr/${attrId}`)
